package com.jie.service.impl;



import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jie.entity.BodyDimension;
import com.jie.mapper.BodyDimensionMapper;
import com.jie.service.IBodyDimensionService;
import com.jie.vo.BodyDimensionVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 身体维度表 服务实现类
 * </p>
 *
 * @author jie
 * @since 2024-04-20
 */
@Service
public class BodyDimensionServiceImpl extends ServiceImpl<BodyDimensionMapper, BodyDimension> implements IBodyDimensionService {
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateBodyInfo(BodyDimensionVO bodyDimensionVO) {
        BodyDimension bodyInfo = this.baseMapper.selectOne(new LambdaQueryWrapper<BodyDimension>().eq(BodyDimension::getUserId, bodyDimensionVO.getUserId()));
        BeanUtils.copyProperties(bodyDimensionVO, bodyInfo);
        return updateById(bodyInfo);
    }
}
